The TextField Component > FTextField (object)

 

FTextField (object)

The methods of the TextField component allow you to control the component at runtime. You can define the visual state of the component, manipulate its properties as well as mask and validate user input. You do not need to use a constructor to access the methods of the component.

The TextField component also supports the complete API of the ActionScript TextField object. This includes support for all properties, methods, events and listeners.

The ActionScript extension for the TextField component is _txf. If you append this to your component instance names, code hinting and auto-completion will be available within the Flash authoring environment.

Component methods do not perform error checking for type, as do other native ActionScript objects and actions. Therefore, you should validate parameters before passing them to methods.

 
Method summary for the FTextField object

Method name

Description

FTextField.getEnabled()

Returns a Boolean value indicating whether the component is enabled (true) or not (false). When the component is not enabled, it will not respond to user interaction. Its visual state will also be grayed-out to indicate its status.

FTextField.getIcon()

Returns a reference to the Movie Clip being used for the icon in the component. This allows you to call methods on and manipulate the Movie Clip being used as an icon on the component. If no icon has been defined, the method will return undefined.

FTextField.getMaskingFunction()

Returns an object containing the name of the function that will be used to mask user input, and the scope that the function will run within.

FTextField.getValidationFunction()

Returns an object containing the name of the function that will be used to validate user input, and the scope that the function will run within.

FTextField.isValid()

If a function has been passed into the setValidationFunction method the return of this function will be returned, otherwise this method returns true. This method can be used in conjunction with the setValidationFunction method to easily validate user input.

FTextField.setEnabled()

Specifies whether the component is enabled (true) or disabled (false). If the component is disabled, it will not accept mouse or keyboard interaction from the user. The component will also be grayed-out to visually indicate its state to the user.

FTextField.setIcon()

This method takes a String which specifies the linkage id of the symbol that should be used as the icon in the component. This allows you to easily display custom icons within the component.

FTextField.setMaskingFunction()

Allows you to mask, transform and restrict user input into the text field. The passed in function will be passed the characters as they are typed. This function can then return what should be added to the text component, overriding the user's input.

FTextField.setSize()

Sets the dimensions in pixels of the component.

FTextField.setValidationFunction()

This method specifies the function that will be called when isValid is called on the component. This makes it easy to validate user input.

FTextField.showIcon()

This method allows the display of an icon within the component. By default, the icon will appear in the top let corner of the component.

FTextField.showScrollBar()

Allows the developer to have scrollbars attached to the TextField.